.class Lcom/instagram/pendingmedia/b/e;
.super Lcom/instagram/d/a;
.source "PendingMediaStoreSerializer.java"


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/instagram/d/a",
        "<",
        "Ljava/lang/Void;",
        "Ljava/lang/Void;",
        "Ljava/util/List",
        "<",
        "Lcom/instagram/pendingmedia/model/c;",
        ">;>;"
    }
.end annotation


# instance fields
.field final synthetic a:Lcom/instagram/pendingmedia/b/c;


# direct methods
.method private constructor <init>(Lcom/instagram/pendingmedia/b/c;)V
    .locals 0
    .parameter

    .prologue
    .line 121
    iput-object p1, p0, Lcom/instagram/pendingmedia/b/e;->a:Lcom/instagram/pendingmedia/b/c;

    invoke-direct {p0}, Lcom/instagram/d/a;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Lcom/instagram/pendingmedia/b/c;Lcom/instagram/pendingmedia/b/d;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 121
    invoke-direct {p0, p1}, Lcom/instagram/pendingmedia/b/e;-><init>(Lcom/instagram/pendingmedia/b/c;)V

    return-void
.end method


# virtual methods
.method protected bridge synthetic a([Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .parameter

    .prologue
    .line 121
    check-cast p1, [Ljava/lang/Void;

    invoke-virtual {p0, p1}, Lcom/instagram/pendingmedia/b/e;->a([Ljava/lang/Void;)Ljava/util/List;

    move-result-object v0

    return-object v0
.end method

.method protected varargs a([Ljava/lang/Void;)Ljava/util/List;
    .locals 7
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "([",
            "Ljava/lang/Void;",
            ")",
            "Ljava/util/List",
            "<",
            "Lcom/instagram/pendingmedia/model/c;",
            ">;"
        }
    .end annotation

    .prologue
    .line 125
    const/4 v0, 0x0

    .line 126
    new-instance v2, Ljava/util/ArrayList;

    invoke-direct {v2}, Ljava/util/ArrayList;-><init>()V

    .line 129
    :try_start_0
    iget-object v1, p0, Lcom/instagram/pendingmedia/b/e;->a:Lcom/instagram/pendingmedia/b/c;

    invoke-static {v1}, Lcom/instagram/pendingmedia/b/c;->a(Lcom/instagram/pendingmedia/b/c;)Landroid/content/Context;

    move-result-object v1

    const-string v3, "pending_media.json"

    invoke-virtual {v1, v3}, Landroid/content/Context;->openFileInput(Ljava/lang/String;)Ljava/io/FileInputStream;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_1
    .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_5
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_2

    move-result-object v1

    .line 130
    :try_start_1
    new-instance v0, Lcom/instagram/pendingmedia/b/f;

    invoke-direct {v0, p0}, Lcom/instagram/pendingmedia/b/f;-><init>(Lcom/instagram/pendingmedia/b/e;)V

    .line 133
    iget-object v3, p0, Lcom/instagram/pendingmedia/b/e;->a:Lcom/instagram/pendingmedia/b/c;

    invoke-static {v3}, Lcom/instagram/pendingmedia/b/c;->b(Lcom/instagram/pendingmedia/b/c;)Lcom/fasterxml/jackson/databind/ObjectMapper;

    move-result-object v3

    invoke-virtual {v3, v1, v0}, Lcom/fasterxml/jackson/databind/ObjectMapper;->readValue(Ljava/io/InputStream;Lcom/fasterxml/jackson/a/f/b;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/List;

    .line 135
    if-eqz v0, :cond_2

    .line 136
    const-string v3, "PendingMediaStoreSerializer"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "Loading serialized pending media list, size: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 138
    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v3

    :cond_0
    :goto_0
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_2

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/pendingmedia/model/c;

    .line 141
    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->x()Lcom/instagram/pendingmedia/model/e;

    move-result-object v4

    sget-object v5, Lcom/instagram/pendingmedia/model/e;->c:Lcom/instagram/pendingmedia/model/e;

    invoke-virtual {v4, v5}, Lcom/instagram/pendingmedia/model/e;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-eqz v4, :cond_1

    new-instance v4, Ljava/io/File;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/c;->q()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v4}, Ljava/io/File;->exists()Z

    move-result v4

    if-eqz v4, :cond_0

    .line 146
    :cond_1
    invoke-interface {v2, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_1} :catch_0
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_4
    .catch Ljava/lang/RuntimeException; {:try_start_1 .. :try_end_1} :catch_3

    goto :goto_0

    .line 150
    :catch_0
    move-exception v0

    move-object v0, v1

    .line 151
    :goto_1
    :try_start_2
    const-string v1, "PendingMediaStoreSerializer"

    const-string v3, "No serialized pending media file found, pending_media.json"

    invoke-static {v1, v3}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_2

    .line 161
    invoke-static {v0}, Lcom/b/a/c/a;->a(Ljava/io/Closeable;)V

    .line 164
    :goto_2
    return-object v2

    .line 161
    :cond_2
    invoke-static {v1}, Lcom/b/a/c/a;->a(Ljava/io/Closeable;)V

    goto :goto_2

    .line 152
    :catch_1
    move-exception v1

    move-object v6, v1

    move-object v1, v0

    move-object v0, v6

    .line 153
    :goto_3
    :try_start_3
    const-string v3, "PendingMediaStoreSerializer"

    invoke-virtual {v0}, Ljava/io/IOException;->getMessage()Ljava/lang/String;

    move-result-object v0

    invoke-static {v3, v0}, Lcom/instagram/g/c;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 154
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/e;->a:Lcom/instagram/pendingmedia/b/c;

    invoke-static {v0}, Lcom/instagram/pendingmedia/b/c;->a(Lcom/instagram/pendingmedia/b/c;)Landroid/content/Context;

    move-result-object v0

    const-string v3, "pending_media.json"

    invoke-virtual {v0, v3}, Landroid/content/Context;->deleteFile(Ljava/lang/String;)Z
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    .line 161
    invoke-static {v1}, Lcom/b/a/c/a;->a(Ljava/io/Closeable;)V

    goto :goto_2

    .line 155
    :catch_2
    move-exception v1

    move-object v6, v1

    move-object v1, v0

    move-object v0, v6

    .line 158
    :goto_4
    :try_start_4
    iget-object v2, p0, Lcom/instagram/pendingmedia/b/e;->a:Lcom/instagram/pendingmedia/b/c;

    invoke-static {v2}, Lcom/instagram/pendingmedia/b/c;->a(Lcom/instagram/pendingmedia/b/c;)Landroid/content/Context;

    move-result-object v2

    const-string v3, "pending_media.json"

    invoke-virtual {v2, v3}, Landroid/content/Context;->deleteFile(Ljava/lang/String;)Z

    .line 159
    throw v0
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0

    .line 161
    :catchall_0
    move-exception v0

    :goto_5
    invoke-static {v1}, Lcom/b/a/c/a;->a(Ljava/io/Closeable;)V

    throw v0

    :catchall_1
    move-exception v1

    move-object v6, v1

    move-object v1, v0

    move-object v0, v6

    goto :goto_5

    :catchall_2
    move-exception v1

    move-object v6, v1

    move-object v1, v0

    move-object v0, v6

    goto :goto_5

    .line 155
    :catch_3
    move-exception v0

    goto :goto_4

    .line 152
    :catch_4
    move-exception v0

    goto :goto_3

    .line 150
    :catch_5
    move-exception v1

    goto :goto_1
.end method

.method protected bridge synthetic a(Ljava/lang/Object;)V
    .locals 0
    .parameter

    .prologue
    .line 121
    check-cast p1, Ljava/util/List;

    invoke-virtual {p0, p1}, Lcom/instagram/pendingmedia/b/e;->a(Ljava/util/List;)V

    return-void
.end method

.method protected a(Ljava/util/List;)V
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Lcom/instagram/pendingmedia/model/c;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 169
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/e;->a:Lcom/instagram/pendingmedia/b/c;

    const/4 v1, 0x1

    invoke-static {v0, v1}, Lcom/instagram/pendingmedia/b/c;->a(Lcom/instagram/pendingmedia/b/c;Z)Z

    .line 171
    invoke-static {}, Lcom/instagram/pendingmedia/b/a;->a()Lcom/instagram/pendingmedia/b/a;

    move-result-object v0

    invoke-virtual {v0, p1}, Lcom/instagram/pendingmedia/b/a;->a(Ljava/util/List;)V

    .line 173
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/e;->a:Lcom/instagram/pendingmedia/b/c;

    invoke-static {v0}, Lcom/instagram/pendingmedia/b/c;->c(Lcom/instagram/pendingmedia/b/c;)Ljava/util/List;

    move-result-object v1

    monitor-enter v1

    .line 174
    :try_start_0
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/e;->a:Lcom/instagram/pendingmedia/b/c;

    invoke-static {v0}, Lcom/instagram/pendingmedia/b/c;->c(Lcom/instagram/pendingmedia/b/c;)Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Runnable;

    .line 175
    invoke-interface {v0}, Ljava/lang/Runnable;->run()V

    goto :goto_0

    .line 178
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0

    .line 177
    :cond_0
    :try_start_1
    iget-object v0, p0, Lcom/instagram/pendingmedia/b/e;->a:Lcom/instagram/pendingmedia/b/c;

    invoke-static {v0}, Lcom/instagram/pendingmedia/b/c;->c(Lcom/instagram/pendingmedia/b/c;)Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->clear()V

    .line 178
    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 179
    return-void
.end method
